package com.dmjj.common.result;

import java.util.HashMap;
import java.util.Map;

/**
 * @Description: TODO
 * @return Map
 * @author 王丽凯
 * @date 2018/12/19
 */
public class configCode {

	/**
	 * 成功
	 */
	public static final int code_1001 = 1001;

	/**
	 * 用户不存在
	 */
	public static final int code_1002 = 1002;

	/**
	 * 密码不正确
	 */
	public static final int code_1003 = 1003;

	/**
	 * 用户已存在
	 */
	public static final int code_1004 = 1004;

	/**
	 * 注册失败
	 */
	public static final int code_1005 = 1005;

	/**
	 * 修改密码失败
	 */
	public static final int code_1006 = 1006;

	/**
	 * 注册成功
	 */
	public static final int code_1007 = 1007;

	/**
	 * 用户名或密码不正确
	 */
	public static final int code_1008 = 1008;

	/**
	 * 参数错误
	 */
	public static final int code_1009 = 1009;

	/**
	 * 服务器异常，请重试
	 */
	public static final int code_1010 = 1010;

	/**
	 * 暂无数据
	 */
	public static final int code_1011 = 1011;

	/**
	 * 数据添加失败
	 */
	public static final int code_1012 = 1012;

	/**
	 * 修改失败
	 */
	public static final int code_1013 = 1013;

	/**
	 * 删除失败
	 */
	public static final int code_1014 = 1014;

	/**
	 * 不属于本次课程学员
	 */
	public static final int code_1015 = 1015;

	/**
	 * 已签到
	 */
	public static final int code_1016 = 1016;

	/**
	 * 已签退
	 */
	public static final int code_1017 = 1017;

	/**
	 * 操作失败
	 */
	public static final int code_1018 = 1018;

	/**
	 * 签到成功
	 */
	public static final int code_1019 = 1019;

	/**
	 * 签退成功
	 */
	public static final int code_1020 = 1020;

	/**
	 * 课程未结束无法签退
	 */
	public static final int code_1021 = 1021;

	/**
	 * 上传文件类型
	 */
	public static final int code_1022 = 1022;

	/**
	 * 文件上传超出允许大小
	 */
	public static final int code_1023 = 1023;
	
	/**
	 * 已评价
	 */
	public static final int code_1024 = 1024;

	/**
	 * 名称已存在
	 */
	public static final int code_1025 = 1025;

	/**
	 *未观看完或还有续集
	 */
	public static final int code_1026 = 1026;
	/**
	 *查询是否观看完整套视频错误
	 */
	public static final int code_1027 = 1027;
	/**
	 *未观看完整套视频
	 */
	public static final int code_1028 = 1028;

	/**
	 * 上传成功
	 */
	public static final int code_1029 = 1029;

	/**
	 * 上传失败
	 */
	public static final int code_1030 = 1030;

	/**
	 * 下载失败
	 */
	public static final int code_1031 = 1031;

	/**
	 * 验签失败
	 */
	public static final int code_1061 = 1061;

	/**
	 * 验签失败,时间超时
	 */
	public static final int code_1062 = 1062;

	/**
	 * 请更新版本，以享受更多服务
	 */
	public static final int code_1063 = 1063;

	public static String codeDesc(int code) {
		String codeDesc = "成功！";
		switch (code) {
		case 1001:
			codeDesc = "成功！";
			break;
		case 1002:
			codeDesc = "用户不存在！";
			break;
		case 1003:
			codeDesc = "密码不正确！";
			break;
		case 1004:
			codeDesc = "用户已存在！";
			break;
		case 1005:
			codeDesc = "注册失败";
			break;
		case 1006:
			codeDesc = "修改密码失败";
			break;
		case 1007:
			codeDesc = "注册成功";
			break;
		case 1008:
			codeDesc = "用户名或密码不正确";
			break;
		case 1009:
			codeDesc = "参数错误";
			break;
		case 1010:
			codeDesc = "服务器异常，请重试";
			break;
		case 1011:
			codeDesc = "暂无数据";
			break;
		case 1012:
			codeDesc = "数据添加失败";
			break;
		case 1013:
			codeDesc = "修改失败";
			break;
		case 1014:
			codeDesc = "删除失败";
			break;
		case 1015:
			codeDesc = "不属于本次课程学员";
			break;
		case 1016:
			codeDesc = "已签到";
			break;
		case 1017:
			codeDesc = "已签退";
			break;
		case 1018:
			codeDesc = "操作失败";
			break;
		case 1019:
			codeDesc = "签到成功";
			break;
		case 1020:
			codeDesc = "签退成功";
			break;
		case 1021:
			codeDesc = "课程未结束无法签退 ";
			break;
		case 1022:
			codeDesc = "上传文件类型";
			break;
		case 1023:
			codeDesc = "文件上传超出允许大小";
			break;
		case 1024:
			codeDesc = "已评价";
			break;
		case 1025:
			codeDesc = "名称已存在";
			break;
		case 1026:
			codeDesc = "未观看完或还有续集";
			break;
		case 1027:
			codeDesc = "查询是否观看完整套视频错误";
			break;
		case 1028:
			codeDesc = "未观看完整套视频";
			break;
		case 1029:
			codeDesc = "上传成功";
			break;
		case 1030:
			codeDesc = "上传失败";
			break;
		case 1031:
			codeDesc = "下载失败";
			break;
		case 1061:
			codeDesc = "验签失败";
			break;
		case 1062:
			codeDesc = "验签失败,时间超时";
			break;
		case 1063:
			codeDesc = "请更新版本，以享受更多服务";
			break;

		}
		return codeDesc;
	}

	/**
	 * @Description: 返回结果标准格式
	 * @param  resultCode 返回码，t 返回的数据
	 * @return
	 * @author 王丽凯
	 * @date 2018/12/19
	 */
	public static <T> Map<String, Object> ResultTemplate(Integer resultCode, T t){
		Map<String, Object> map = new HashMap<>();
		if (resultCode==null){
			resultCode=0;
		}
		map.put("code",resultCode);
		map.put("msg",codeDesc(resultCode));
		map.put("data",t);
		return map;
	}
}
